﻿Imports System.Data.SqlClient
Imports Microsoft.Reporting.WinForms
Public Class InvoiceReport
    Dim cmd As New SqlCommand

    Private Sub InvoiceReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        condb()
        cmd.Connection = cn
        cmd.CommandText = (" select a.*,b.Product_Name ,b.Price ,b.QT ,c.Discount,c.TotalAmount FROM  tblinvoice a INNER Join tblOrderItems b ON  a.InvoiceID = b.InvoiceID   Left Join TotalAmount c on   a.InvoiceID = c.InvoiceID where a.InvoiceID='" & Totalmoney.txtinvoice.Text & "'")
        Dim dr = cmd.ExecuteReader
        Dim dt As New DataTable
        dt.Load(dr)
        dr.Close()
        Me.ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource("DataSet1", dt))
        Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "WindowsApplication2.sellinvoice.rdlc"
        Me.ReportViewer1.SetDisplayMode(DisplayMode.PrintLayout)
        Me.ReportViewer1.ZoomMode = ZoomMode.FullPage
        Me.ReportViewer1.RefreshReport()
    End Sub
End Class